package com.curso.sesion9;
import java.io.*;

class OpsFileWriter {
	public static void main(String [] args) {
		char[] Contenido = new char[50];           // to store input
		int size = 0;
		try {
			File file = new File("C:\\computer\\fileWrite2.txt");             // just an object

			FileWriter fw = new FileWriter(file); 
			// create an actual file
			// & a FileWriter obj
			fw.write("cosa coso cosita riquita");       // write characters to // the file
			fw.flush();                       // flush before closing
			fw.close();                       // close file when done

			FileReader fr = new FileReader(file);// create a FileReader	// object
			size = fr.read(Contenido);         // read the whole file!
			System.out.print(size + " ");     // how many bytes read
			for(char c : Contenido) {                 // print the array
				System.out.print(c);
			fr.close();       
			}// again, always close }
		} catch(IOException  e) {
			e.printStackTrace();
		}
	}
}

